import request from 'axios'
if(process.env.NODE_ENV==="development"){
request.defaults.baseURL = 'http://192.168.1.3:100/api';//开发环境192.168.1.3
}else{
request.defaults.baseURL = 'http://192.168.1.2:100/api';//正式环境
}
request.defaults.timeout = 60000;

/**
 * 请求拦截
 */
request.interceptors.request.use(
    config=>{
        return config;
    },
    error => {
        return Promise.reject(error)
    }
)

/**
 * 响应拦截
 */
 request.interceptors.response.use(
    response => {
        return response.data//返回正确信息
    },
    error => {
      return Promise.reject(error)
    }
)
export default request